import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';

/**
 * Generated class for the MinePage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-mine',
  templateUrl: 'mine.html',
})
export class MinePage {

  constructor(public navCtrl: NavController, public navParams: NavParams) {
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad MinePage');
    let myVideo = document.getElementsByTagName('video');
    console.log("myVIdeo==="+myVideo.length);
  }

  ionViewWillLeave() {
    // this.playPause(0);
  }

  playPause(num) {
    // let myVideo = document.getElementsByTagName('video')[0];
    let myVideo = document.getElementsByTagName('video')[num];
    if (myVideo.paused) {
      myVideo.play();
    }
    else {
      myVideo.pause();
      myVideo.currentTime = 0;
    }
  }
  
  //下拉加载
  doRefresh(refresher) {
    console.log('Begin async operation', refresher);
    setTimeout(() => {
      console.log('Async operation has ended');
      // this.getNewArticle(this.pageContent);
      refresher.complete();
    }, 2000);
  }

  doInfinite(infiniteScroll) {
    console.log('Begin async operation');
    setTimeout(() => {
      // for (let i = 0; i < 30; i++) {
      //   this.items.push( this.items.length );
      // }
      console.log('Async operation has ended');
      infiniteScroll.complete();
    }, 2000);
  }
}
